package service

import (
	"errors"
	"renter/application/api"
	AccountRepo "renter/infrastructure/models"
	"time"
)

func Register(cmd api.RegisterCmd) error {
	account := AccountRepo.SelectByAccount(cmd.Account)
	if account != nil {
		return errors.New("已注册")
	}
	//先创建用户

	//再保存账号
	currentTime := time.Now().UnixMilli()
	insertPo := AccountRepo.Account{
		Account:    cmd.Account,
		Password:   cmd.Password,
		CreateTime: currentTime,
		UserId:     1,
	}

}
